<template>
  <div class="login">
    <h3>用户登录</h3>
    <div>
      <input type="text" v-model="username" />
    </div>
    <div>
      <input type="text" v-model="password" />
    </div>
    <div>
      <button @click="login">用户登录</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: ''
    }
  },
  methods:{
    login(){
      if(this.username === 'admin'){
        sessionStorage.setItem('token',this.username)
        this.$router.push('/admin/user')
      }
    }
  },
  mounted() {
    // console.log(this.$route)
    // document.title = this.$route.meta.title
  }
}
</script>

<style lang="scss" scoped>
.login {
  width: 300px;
  margin: 10px auto;
}
</style>
